package com.sweet.imserver.utils;

import java.nio.charset.StandardCharsets;
import java.util.Base64;

public class Base64Utils {

  public static String base64ToString(String base64) {
    byte[] decode = Base64.getDecoder().decode(base64);
    return new String(decode, StandardCharsets.UTF_8);
  }

  public static String stringToBase64(String str) {
    byte[] encode = Base64.getEncoder().encode(str.getBytes(StandardCharsets.UTF_8));
    return new String(encode, StandardCharsets.UTF_8);
  }
}
